const express = require('express')
const morgan = require('morgan')
const handlerError = require('./middleware/handler-error')
const router = require('./router')
require('./model')

const app = express()
const PORT = process.env.PORT || 3000

app.use(morgan('dev'))
app.use(express.json())

app.use(router)

app.use(handlerError())

app.listen(PORT, () => {
  console.log(`application is running port ${PORT}`)
})
